﻿@model ReferralTracker.Models.Account.UserEditModel

@section scripts {
    <script src="@Url.Content("~/Scripts/Account/userpage.js")" type="text/javascript"></script>
}

@using (Html.BeginForm()) { 
    <input id="UserId" type="hidden" value="@Model.Id" />
    <table>
        <thead>
            <tr>
                <td>User Details</td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>@Html.LabelFor(m => m.FirstName)</td>
                <td>@Html.TextBoxFor(m => m.FirstName)</td>
            </tr>
            <tr>
                <td>@Html.LabelFor(m => m.LastName)</td>
                <td>@Html.TextBoxFor(m => m.LastName)</td>
            </tr>
            <tr>
                <td>@Html.LabelFor(m => m.EMail)</td>
                <td>@Html.TextBoxFor(m => m.EMail)</td>
            </tr>
            <tr>
                <td>@Html.LabelFor(m => m.SignUpIPAddress)</td>
                <td>@Model.SignUpIPAddress</td>
            </tr>
            <tr>
                <td>@Html.LabelFor(m => m.LastLogInIPAddress)</td>
                <td>@Model.LastLogInIPAddress</td>
            </tr>
            <tr>
                <td>@Html.LabelFor(m => m.LastLoginDate)</td>
                <td>@Model.LastLoginDate</td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td><input id="btnUpdateUser" type="button" value="Update User" onclick="javascript:referraltracker.account.userpage.updateUser()" /></td>
            </tr>
        </tfoot>
    </table>
    <table>
        <thead>
            <tr>
                <td>Update Password</td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Current Password</td>
                <td><input id="CurrentPassword" type="password" /></td>
            </tr>
            <tr>
                <td>New Password</td>
                <td><input id="NewPassword" type="password" /></td>
            </tr>
            <tr>
                <td>Confirm Password</td>
                <td><input id="ConfirmPassword" type="password" /></td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td><input id="btnUpdatePassword" type="button" value="Update Password" onclick="javascript:referraltracker.account.userpage.updatePassword()" /></td>
            </tr>
        </tfoot>
    </table>
    <table>
        <thead>
            <tr>
                <td>Referral Information</td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>@Html.LabelFor(m => m.ReferralId)</td>
                <td><strong><span id="ReferralId">@Model.ReferralId</span></strong></td>
            </tr>
            <tr>
                <td>User Registration Referral Link</td>
                <td><strong>@Model.RegisterReferralLink</strong></td>
            </tr>
            <tr>
                <td>Generate Referral Link</td>
                <td><input id="GeneratedReferralLink" type="text" /></td>
            </tr>
            <tr>
                <td></td>
                <td><input id="btnGenerate" type="button" value="Generate" onclick="javascript:referraltracker.account.userpage.generateLink()" /></td>
            </tr>
            <tr>
                <td></td>
                <td><strong><span id="GeneratedLink"></span></strong></td>
            </tr>
        </tbody>
    </table>
    <table>
        <thead>
            <tr>
                <td>Referral Activity</td>
            </tr>
            <tr>
                <td>Date</td>
                <td>Type</td>
                <td>Url Accessed</td>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model.ReferralActivities) {
                <tr>
                    <td>@item.Date</td>
                    <td>@item.ReferralType</td>
                    <td>@item.Link</td>
                </tr>
            }
        </tbody>
    </table>
}

